import {defineStore} from 'pinia'
import {reqHospitalDetail,reqHospitalDeparment} from '@/api/hospital/index'
const useDetailStore = defineStore('Detail',{
    state:()=>{
        return {
            // 医院详情的数据
            hospitalInfo:({} as any),
            // 医院科室数据
            deparmentArr:([] as any)
        }
    },
    actions:{
        // 获取医院详情的方法
        async getHospital(hoscode:any){
            let result = await reqHospitalDetail(hoscode)
            if(result.code==200){
                this.hospitalInfo = result.data
            }
        },
        // 获取某一个医院科室的数据
        async getDeparment(hoscode:any){
            let result = await reqHospitalDeparment(hoscode)
            if(result.code==200){
                this.deparmentArr = result.data
            }
        }
    },
    getters:{}
})

export default useDetailStore